package com.hundsun.cprs.yyt.service.trade.service.impl;

import com.hundsun.cprs.yyt.service.trade.domain.query.TradeMatchDetailQuery;
import com.hundsun.cprs.yyt.service.trade.dto.MatchRequest;
import com.hundsun.cprs.yyt.service.trade.dto.TradeMatchDetailInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.hundsun.cprs.yyt.common.base.BaseService;
import com.hundsun.cprs.yyt.service.trade.dao.TradeMatchDetailDao;
import com.hundsun.cprs.yyt.service.trade.domain.TradeMatchDetail;
import com.hundsun.cprs.yyt.service.trade.service.TradeMatchDetailService;

import java.util.List;

@Service
public class TradeMatchDetailServiceImpl extends BaseService implements TradeMatchDetailService {
    
    @Autowired
    private TradeMatchDetailDao tradeMatchDetailDao;

    @Override
    @Transactional
    public void updateTradeMatchDetail(String sn, Integer fundProcess) {
        TradeMatchDetail detail = tradeMatchDetailDao.selectBySn(sn);
        detail.setIsFundProcess(fundProcess);
        tradeMatchDetailDao.updateByPrimaryKeySelective(detail);
    }

    @Override
    public void queryDetailByPage(TradeMatchDetailQuery query) {
        List<TradeMatchDetailInfo> tradeMatchDetailInfoList = tradeMatchDetailDao.queryByPage(query);
        query.compatible(tradeMatchDetailInfoList);
    }

    @Override
    public List<TradeMatchDetail> getLastDetail(MatchRequest request) {
        return tradeMatchDetailDao.getLastDetail(request);
    }
}
